package com.gitee.swsk33.nuistcanteenselector.api;

import com.gitee.swsk33.nuistcanteenselector.dataobject.Store;
import com.gitee.swsk33.nuistcanteenselector.model.Result;
import com.gitee.swsk33.nuistcanteenselector.service.StoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StoreAPI {

	@Autowired
	private StoreService storeService;

	@GetMapping("/getstore/canteen/{id}/type/{type}")
	public Result<List<Store>> getStore(@PathVariable("id") Integer canteenId, @PathVariable("type") String type) {
		return storeService.getByCanteenAndType(canteenId, type);
	}

}